[codex] Harden Windows file indexing and UserAssist parsing#7896
[codex] Harden Windows file indexing and UserAssist parsing#7896tianmind-studio wants to merge 3 commits into
Conversation
Greptile SummaryThis PR hardens two Windows-specific parsing paths: file-index directory skipping is made case-insensitive (fixing missed skips for paths like
Confidence Score: 4/5Both changes are narrow, well-targeted fixes with matching unit tests; the only thing to double-check is the exported The unsigned-read change in
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Directory entry name] --> B["name.toLowerCase()"]
B --> C{SKIP_DIRS.has?}
C -- yes --> D[Skip directory]
C -- no --> E{depth <= MAX_DEPTH?}
E -- yes --> F[Descend into directory]
E -- no --> G[Stop recursion]
H[UserAssist registry blob] --> I["readUInt32LE(OFF_RUN_COUNT)"]
H --> J["readUInt32LE(OFF_FOCUS_COUNT)"]
H --> K["readUInt32LE(OFF_FOCUS_MS)"]
I --> L[runCount: 0..4294967295]
J --> M[focusCount: 0..4294967295]
K --> N["focusSeconds = round(focusMs / 1000)"]
N --> O[Aggregate by friendly app name]
O --> P[Sort by focusSeconds desc]
Reviews (1): Last reviewed commit: "fix(windows): harden file index and User..." | Re-trigger Greptile |
d26d773 to
5d899c3
Compare
5d899c3 to
86dfe2e
Compare
Summary
.GIT,Node_Modules, or__PYCACHE__do not get scanned.SKIP_DIRSentries verbatim while using an internal normalized set for case-insensitive matching.Why
Windows directory matching is case-insensitive in practice, but the scan skip list was case-sensitive. UserAssist binary fields are DWORD counters; reading them as signed integers can make high-bit values negative, which would corrupt seeded usage ranking for long-lived installs.
Refresh
mainat1a5824403b.86dfe2e724.SKIP_DIRSis already addressed; the review thread is resolved/outdated.Validation
vitest run src/main/fileIndex/scanRules.test.ts src/main/usage/userAssist.test.ts-> 2 files passed, 22 tests passednpm run typecheck-> passedprettier --check src/main/fileIndex/scanRules.ts src/main/fileIndex/scanRules.test.ts src/main/usage/userAssist.ts src/main/usage/userAssist.test.ts-> passedgit diff --check origin/main...HEADscripts/pre-commitwith the backend Windows venv and local Dart SDK onPATH